package com.xyd.servlet;

import com.xyd.entity.Order;
import com.xyd.service.impl.OrderServiceImpl;
import com.xyd.util.JsonUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/OrderGetByEoIdServlet")
public class OrderGetByEoIdServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String x=request.getParameter("id");
        long id=Long.parseLong(x);
        OrderServiceImpl orderService = new OrderServiceImpl();
        Order order=new Order();
        order=orderService.getOrderByEoId(id);
        JsonUtil.toJson(response,order);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
